<%--
  Date: 2024/10/10 13:45
  Description: 讲解el表达式的基本使用
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<%--
    el表达式
       基本语法:  ${}
       作用:  从域对象中取值
             jsp  九大内置对象   包含四个域对象   数据存储和传递

                                                  作用域
               pageContext    当前页对象           当前页有效
               request        请求对象           同一次请求有效
               session        会话对象           同一次会话有效
               application    应用对象           同一个应用有效
--%>
<%
    pageContext.setAttribute("pctx","hello pageContext");
    pageContext.setAttribute("number","10");

    request.setAttribute("rqst","hello request");
    request.setAttribute("number","20");

    session.setAttribute("sson","hello session");
    session.setAttribute("number","30");

    application.setAttribute("app","hello application");
    application.setAttribute("number","40");
%>

<%-- el表达式的取值方式
    el 表达式在取值时默认会遍历域对象    从小范围到大范围遍历  作用域
    pageContext   ->  request  ->  session  -> application
--%>

<h3>pageContext = ${pctx}</h3>
<h3>request = ${rqst}</h3>
<h3>session = ${sson}</h3>
<h3>application = ${app}</h3>
<h3>number = ${number}</h3>
<h3>test = ${test}</h3>

<hr>

<h3>pageContext number = ${pageScope.number}</h3>
<h3>request number = ${requestScope.number}</h3>
<h3>session number = ${sessionScope.number}</h3>
<h3>application number = ${applicationScope.number}</h3>


</body>
</html>
